<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateUserRedPacketBusinTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('user_red_packet_busin', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('user_id')->comment('用户id');
            $table->string('user_mobile',11)->comment('用户手机号');
            $table->decimal('amount',16,2)->comment('红包金额');
            $table->decimal('minimum_amount',16,2)->default(0.00)->comment('最低使用金额');
            $table->integer('shop_id')->default(0)->comment('商家id');
            $table->integer('city_id')->default(0)->comment('城市id(0:全国，其他)');
            $table->date('start_time')->comment('开始时间');
            $table->date('end_time')->comment('截止时间');
            $table->dateTime('use_time')->comment('使用时间');
            $table->integer('status',4)->default(1)->comment('状态(0:已用,1:可使用,-1:已过期,-2:已失效)');
            $table->string('type',32)->comment('类型(1:）');
            $table->decimal('hq_amount',16,2)->default(0.00)->comment('总部红包金额');
            $table->decimal('agent_amount',16,2)->default(0.00)->comment('代理商红包金额');
            $table->integer('first_class_id')->comment('一级分类');
            $table->integer('second_class_id')->comment('二级分类');
            $table->string('first_class_name',32)->comment('一级分类名称');
            $table->string('second_class_name',32)->comment('二级分类名称');
            $table->string('position',32)->comment('领取位置，首页、充值、买单等');
            $table->string('position_id',64)->comment('领取位置id');
            $table->string('evryday_use_time_start',32)->comment('每天使用时段：开始(格式：18:00:00)');
            $table->string('evryday_use_time_end',32)->comment('每天使用时段：结束(格式：18:00:00)');
            $table->string('is_evryday_user_time',4)->default(0)->comment('是否有使用时段（0：没有，1：有）');
            $table->string('is_limit_use_day',4)->default(0)->comment('是否限制当日使用');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('user_red_packet_busin');
    }
}
